home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / c / dicepj20.lha / diceproject / sources / divers.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-05  |  3.1 KB  |  121 lines

  1.  
  2. #include <clib/intuition_protos.h>
  3. #include <clib/gadtools_protos.h>
  4. #include <clib/exec_protos.h>
  5. #include <clib/utility_protos.h>
  6. #include <clib/locale_protos.h>
  7.  
  8. #include <stdlib.h>
  9. #include <string.h>
  10.  
  11. #include "project.h"
  12.  
  13. #define CATCOMP_NUMBERS
  14.  
  15. #include "project.catalog.h"
  16.  
  17. extern char PubName[];
  18. extern struct Catalog *Catalog;
  19.  
  20. char *ProjectPathName;
  21. char *ProjectName;
  22. char *WindowTitle;
  23.  
  24. char *StartDir;
  25. char *PrgDir;
  26.  
  27. /****************************************************************************
  28. ***                                      ***
  29. ***    Fonctions divers                          ***
  30. ***                                      ***
  31. ****************************************************************************/
  32.  
  33. void ReplaceChar( char **dest , char *source )
  34. {
  35.     free( *dest );
  36.     *dest = strdup( source );
  37. }
  38.  
  39. /****************************************************************
  40. ***    Change le nom du projet en cours              ***
  41. ****************************************************************/
  42.  
  43. void ChangeProjectName( char *pathname ) {
  44.   char temp[200];
  45.   char *wintitle = "Project Handler : Sources Window / Project Name : ";
  46.  
  47.     ReplaceChar( &ProjectPathName , pathname );
  48.     ReplaceChar( &ProjectName , BaseName( pathname ) );
  49.     ProjectName[ strlen(ProjectName) - 4 ] = 0;
  50.     if ( ROMVersion >=38 )
  51.     strcpy( temp , GetCatalogStr( Catalog , MSG_WIN_TITLE_SOURCE , wintitle ) );
  52.     else
  53.     strcpy( temp , wintitle );
  54.     strcat( temp , BaseName( pathname ) );
  55.     ReplaceChar( &WindowTitle , temp );
  56.     SetWindowTitles( ProjectWnd , WindowTitle , (UBYTE *)-1 );
  57. }
  58.  
  59. /****************************************************************
  60. ***    Change le nom du repertoire de DICE              ***
  61. ****************************************************************/
  62.  
  63. void ChangeDICEDir( char *dir ) {
  64.   char *prgt;
  65.  
  66.     ReplaceChar( &DICEDir , dir );
  67.     prgt = malloc( strlen( DICEDir ) + 10 );
  68.     strcpy( prgt , DICEDir );
  69.     strcat( prgt , "/bin/" );
  70.     ReplaceChar( &PrgDir , prgt );
  71.     free( prgt );
  72. }
  73.  
  74. /****************************************************************
  75. ***    Lance l'edition d'un module spécifié par son nom      ***
  76. ****************************************************************/
  77.  
  78. void EditModule( char *name ) {
  79.   char *buf;
  80.   struct TagItem *ti;
  81.  
  82.     ti = FindTagItem( SA_PubName , ScreenTags );
  83.     if ( ti )
  84.     SetDefaultPubScreen( (char *)(ti->ti_Data) );
  85.     buf = malloc( strlen( PrgDir ) + strlen( name ) + 20 );
  86.     strcpy( buf , Editor );
  87.     strcat( buf , " \"" );
  88.     strcat( buf , name );
  89.     strcat( buf , "\"" );
  90.     Launch( buf , TRUE );
  91.     free( buf );
  92. }
  93.  
  94. /****************************************************************
  95. ***    Gestion des fichiers de commentaires              ***
  96. ****************************************************************/
  97.  
  98. char *CommentName( char *module ) {
  99.   char *result;
  100.  
  101.     result = malloc( strlen( module ) + 10 );
  102.     strcpy( result , module );
  103.     strcat( result , ".comment" );
  104.     return( result );
  105. }
  106.  
  107. BOOL IsCommented( char *module ) {
  108.   char *modulec;
  109.   struct FileInfoBlock fib;
  110.   BOOL r=FALSE;
  111.  
  112.     modulec = CommentName( module );
  113.     if ( GetInfo( &fib , modulec ) ) {
  114.     r = TRUE;
  115.     }
  116.     free( modulec );
  117.     return( r );
  118. }
  119.  
  120.  
  121.